package com.wanjia.estate.config;

import cn.hutool.core.collection.CollUtil;
import com.wanjia.estate.filter.EstateFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<EstateFilter> estateFilterFilterRegistrationBean(@Autowired EstateFilter filter) {
        FilterRegistrationBean<EstateFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(filter);
        bean.setUrlPatterns(CollUtil.newArrayList("/*"));
        return bean;
    }
}
